package com.foo.designpattern.state.state2;

/**
 * com.foo.designpattern.state
 * Created with IntelliJ IDEA.
 * Created by jiang on 2016-06-08 15:51.
 *
 * @Description
 */

public class SpiteVoteState implements VoteState {
    @Override
    public void vote(String user, String voteItem, VoteManager manager) {
        String s = manager.getMapVote().get(user);
        if (null != s) {
            manager.getMapVote().remove(user);
        }
        System.out.println("你有恶意刷票行为，投票资格被取消！");
        if (manager.getMapVoteCount().get(user) >= 7) {
            // 在状态的处理类中进行状态的维护和转换
            manager.getMapState().put(user, new BlackVoteState());
        }
    }
}
